package com.loopy.fruns.utils;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

public class DataUtils {
    public static <T> T copyParamToBean(Map value, T bean){
        try {
            BeanUtils.populate(bean,value);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return bean;
    }
    public static Integer parseInt(String val,Integer defaultVal){
        try {
            return Integer.parseInt(val);
        } catch (NumberFormatException e) {
            System.out.println("格式不正确");
        }
        return defaultVal;
    }

}
